const URLS={
  url1:'https://m.douban.com/rexxar/api/v2/subject_collection/movie_showing/items'
};
const calc=function(a,b){
  return a+b;
};
const ajaxRequest=function(){
    let p=new Promise(function(resolve,reject){
        wx.request({
          url: 'https://m.douban.com/rexxar/api/v2/subject_collection/movie_showing/items',
          data:{
            start:0,
            count:7,
          },
          method:"GET",//请求方式必须为大写字母
          success:resolve,
          fail:reject
        });
    });

    return p;
};

const ajaxRequest2=function(options={}){
  return new Promise(function(resolve,reject){
      options.success=resolve;
      options.fail=reject;
      wx.request(options);
  });
  
};

//查询数据
const queryData=function(){
    return ajaxRequest2({
        url:URLS.url1,
        method:"GET",
        data:{
          start:0,
          count:3
        }
    });

};

module.exports={
  calc,
  ajaxRequest,
  queryData
};